<template>
	<span class="app-mob-icon">
		<van-icon
			:badge="badge"
			v-if="isIconClass(iconClass)"
			class-prefix="fa"
			:name="getIconClass"
			:size="size"
		/>
		<van-icon
			:badge="badge"
			v-else-if="iconClass || imgPath"
			:name="iconClass || imgPath"
			:size="size"
		/>
		<van-icon
			:badge="badge"
			v-else
			:class-prefix="fontIconClass"
			:size="size"
		/>
	</span>
</template>

<script setup lang="ts">
import { iconTextProps } from './icon';
const props = defineProps(iconTextProps);
const isIconClass = (cssClass: string) => {
	return cssClass && cssClass.startsWith('fa fa-');
};
const getIconClass = computed(() => {
	return props.iconClass ? props.iconClass.substring(6) : '';
});
</script>
